package com.cskaoyan.controller.wx;

import com.cskaoyan.service.wx.WxSearchService;
import com.cskaoyan.vo.BaseRespVo;
import com.cskaoyan.vo.wx.WxSearchIndexVo;
import com.cskaoyan.vo.wx.WxhistoryKeywordVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author: feisl
 * @Date: 2021/5/13 10:06
 */
@RestController
@RequestMapping("wx/search")
public class WxSearchController {

    @Autowired
    WxSearchService wxSearchService;
    @RequestMapping("index")
    public BaseRespVo index(){

        WxSearchIndexVo wxSearchIndexVo = wxSearchService.index();

        return BaseRespVo.ok(wxSearchIndexVo);
    }

    @RequestMapping("helper")
    public BaseRespVo helper(String keyword){


        List<String> helper = wxSearchService.helper(keyword);

        return BaseRespVo.ok(helper);
    }

    @RequestMapping("clearhistory")
    public BaseRespVo clearhistory(){

        wxSearchService.clearhistory();

        return BaseRespVo.ok();
    }
}
